{% extends 'homepage.html' %}
{% block content %}
{# Refine search page #}


<h2> Further refine search </h2>

<form>
<input type="hidden" name="start" value="{{info.start}}"/>
<input type="hidden" name="paging" value="0"/>
<table border="0">

<tr>
<td align=left> {{KNOWL('nf.degree', title='degree')}} <td align=left> <input type='text' name='degree' size="3" value="{{info.degree}}"></td>


<td align=left> {{KNOWL('nf.signature', title='signature')}} <td align=left> <input type='text' name='sig' size=5 value="{{info.sig}}"></td>

<td align=left> {{KNOWL('nf.galois_group', title='Galois group')}} <td align=left> <input type='text' name='galois_group' size=3 value="{{info.galois_group}}"></td></tr>
<tr>
<td align=left> {{KNOWL('nf.class_number', title='class number')}} <td align=left> <input type='text' name='class_number' size=3 value="{{info.class_number}}"></td>
<td align=left> {{KNOWL('nf.ideal_class_group', title='class group')}} <td align=left> <input type='text' name='cl_group' size=5 value="{{info.cl_group}}"></td>
<td align=left> {{KNOWL('nf.unramified_prime', title='unramified primes')}}<td align=left> <input type='text' name='ur_primes' size=3 value="{{info.ur_primes}}"></td>
</tr>
<tr>
<td align='left'> {{KNOWL('nf.discriminant', title='discriminant')}} range <td align='left' colspan='2'> <input type='text' name='discriminant' size='20' value="{{info.discriminant}}"></td>
</tr>

<tr>
<td align='left' colspan='4'>Maximum number of fields to display <input type='text' name='count' value="{{info.count}}" size='10'>
</td>
</tr>


<tr> 
<td align=left><button type='submit' value='refine'>Search again</button></td> 
</tr>
</table>
</form>

{% if info.err is defined %}

{% if info.label is defined %}
<form>
<table border=0 cellpadding=5>
<tr>
<td>Field:&nbsp;&nbsp;</td>
<td ><input type='text' name='natural' size=60 value="{{info.label}}"> </td>
<td><button type='submit' name='search' value='Go'>Go</button></td>
</tr>
<tr>
<td colspan="3" rowspan="2"><span class="formexample"> Enter either a
<a href="FieldLabels">field label</a>, e.g. 2.2.5.1 for
    \(\mathbb{Q}(\sqrt{5})\); a nickname, e.g. Q or Qsqrt5 or Qzeta7; or a polynomial in x, e.g. x^2+1</span></td>
</tr>
</table>
</form>
{% endif %}

<h2>Error</h2>
<div>
  {{ info.err|safe }}
  <p>
  Either modify your search above or go <input type=button value="Back" onClick="history.go(-1)">
</div>
{% else %}
<h2> Results: ({{info.report}})</h2>

{% if info.number > 0 %}
<table border=1 cellpadding=5 class="ntdata" id="fieldTab"`>
<thead>
<tr>
<th>Label</th>
<th>Polynomial</th>
<th>Discriminant</th>
<th>Galois group</th>
<th>Class group</th>
</tr>
</thead>
<tbody>
{% for field in info.fields: %}
{% set wnf = info.wnf(field) %}
<tr>
<td align='left'><a href="/NumberField/{{field.label}}">{{field.label}}</a></td>
<td>{{ wnf.web_poly() | safe }}</td>
<td>\( {{ wnf.disc_factored_latex() }} \)</td>
{# <td>{{ info.group_display(field.galois) }}</td> #}
<td>{{ wnf.galois_string() }}</td>
{% if field.cl_group is defined %}
  {% if field.cl_group=='' %}
    <td> Trivial </td>
  {% else %}
    {# <td>{{info.class_group_display(field.cl_group)}}</td> #}
    <td>{{ wnf.class_group_invariants() }}</td>
  {% endif %}
{% else %}
  <td>n/a</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
<br>
   {% if info.all == 0 %}
      <a href="#" class="navlink" onclick="decrease_start_by_count_and_submit_form();return false">Previous</A>
      <a href="#" class="navlink" onclick="increase_start_by_count_and_submit_form();return false">Next</A></td>
   {% endif %}

{% endif %}
{% endif %}


{% endblock %}
